package org.justframework.server;

import org.justframework.core.ServerConnector;
import org.mortbay.jetty.Server;

public class HttpServer implements ServerConnector{
	
	private Server server;

	public void startup() {
		try {				
			int port = 8080;
			Server server = new Server(port);
			server.setHandler(new HttpHandlerAdapter());
			server.start();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/**
	 * 关闭服务器
	 */
	public void shutdown() {
		try {
			server.destroy();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
}
